package com.dabai.simpleconnection.adapter;

import android.app.Activity;
import android.graphics.Color;
import android.text.util.Linkify;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dabai.simpleconnection.R;
import com.dabai.simpleconnection.bean.ChatModel;
import com.dabai.uitools.utils.DisplayUtils;

/**
 * Description : Other
 *
 * @author BAI
 */
public class ChatAdapter extends BaseQuickAdapter<ChatModel, BaseViewHolder> {

    Activity activity;

    public ChatAdapter(Activity activity,int layoutResId) {
        super(layoutResId);
        this.activity = activity;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, ChatModel chatModel) {

        TextView textView1 = baseViewHolder.getView(R.id.textView1);
        LinearLayout linearLayout = baseViewHolder.getView(R.id.lineLayout);

        linearLayout.setGravity(chatModel.getGravity());

        textView1.setMaxWidth(DisplayUtils.getActivityWidthPixels(activity)-200);
        textView1.setTextSize(chatModel.getTextSize());
        textView1.setTextColor(chatModel.getTextColor());
      //  textView1.setTextIsSelectable(chatModel.isTextIsSelectable());

        textView1.setText(chatModel.getContent());

    }
}
